package com.indexingsystem.system.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.indexingsystem.boss.admin.mapper.RuleOperationsMapper;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.RuleOperations;
import com.indexingsystem.boss.utils.BeanUtils;
import com.indexingsystem.system.service.IRuleOperationsService;

@Service
public class RuleOperationsServiceImpl implements IRuleOperationsService{

	@Resource  
	private RuleOperationsMapper ruleOperationsMapper;
	@Override
	public int deleteByPrimaryKey(String ruleOperationId) {
		return ruleOperationsMapper.deleteByPrimaryKey(ruleOperationId);
	}

	@Override
	public int insertSelective(RuleOperations record) {
		return ruleOperationsMapper.insertSelective(record);
	}

	@Override
	public RuleOperations selectByPrimaryKey(String ruleOperationId) {
		return ruleOperationsMapper.selectByPrimaryKey(ruleOperationId);
	}

	@Override
	public int updateByPrimaryKeySelective(RuleOperations record) {
		return ruleOperationsMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public PagedResult<RuleOperations> selectRuleOperationsList(Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		//startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		PageHelper.startPage(pageNo,pageSize);  
		return BeanUtils.toPagedResult(ruleOperationsMapper.selectRuleOperationsList());
	}
}